package org.example.strategy;

import java.util.ArrayList;

public class SwitchStrategy implements EditorStrategy {

    private String fileName;
    private String filePath;
    private Integer fileNumber;
    private ArrayList<String> loadedFileName;
    private ArrayList<String> loadedFilePath;
    public SwitchStrategy(Integer fileNumber, ArrayList<String> loadedFileName,ArrayList<String> loadedFilePath) {
        this.fileNumber = fileNumber;
        this.loadedFileName = loadedFileName;
        this.loadedFilePath = loadedFilePath;
    }

    @Override
    public void performAction() {
        if (fileNumber > loadedFileName.size()){
            System.out.println("Please enter the correct number!");
            return;
        }
        fileName = loadedFileName.get(fileNumber - 1);
        filePath = loadedFilePath.get(fileNumber - 1);
    }

    public String getFileName(){
        return fileName;
    }
    public String getFilePath(){
        return filePath;
    }
}
